<?php
/**
 * Created by PhpStorm.
 * User: win10
 * Date: 2017/12/27
 * Time: 18:07
 */
namespace api\controllers;

use common\models\kaoguobao\User;
use common\services\config\Config;
use common\services\UserService;

class UserController extends BaseController
{

    public function actionUserFormData()
    {
        $wechatId   = $this->user_id;
        if(!$wechatId){
            return $this->errorResult(Config::$notLogin);
        }
        $key     = trim($this->request->post('key'));
        $userId = UserService::userData($wechatId);
        if($userId == false){
            return $this->errorResult(Config::$notUser);
        }
        if(empty(User::$key[$key])){
            return $this->errorResult(Config::$notKey);
        }
        $result = UserService::userList($userId,$key);
        return $this->endReponse('0',$result);
    }
}